package org.example.servicecounselor.config;

import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * RabbitMQ配置类
 * 配置消息转换器以支持Task类的序列化和反序列化
 */
@Configuration
public class RabbitMQConfig {

    /**
     * 配置消息转换器，允许Task类和其他相关类的序列化
     */
    @Bean
    public SimpleMessageConverter messageConverter() {
        SimpleMessageConverter converter = new SimpleMessageConverter();
        // 允许Task类和其他相关类的序列化
        converter.addAllowedListPatterns(
                "org.example.model.student.bean.*",
                "org.example.model.manage.bean.po.*",
                "java.lang.*",
                "java.util.*",
                "java.util.concurrent.*",
                "java.time.*"
        );
        return converter;
    }
}